<template>
	<view class="p-t-10">
		<view class="modelBox flex_b" style="border-radius: 10rpx;">
			<view class="">隐藏在线状态</view>
			<uv-switch v-model="switchValue" @change="setStealth" size="18" activeColor="#ff5e0f"></uv-switch>
		</view>
		<view class="modelBox flex_b" style="border-radius: 10rpx;" >
			<view class="">接受速搭</view>
			<uv-switch v-model="supeiValue" size="18" @change="setMate" activeColor="#ff5e0f"></uv-switch>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				switchValue:false,
				supeiValue:true,
				userInfo:{}
			};
		},
		onLoad() {
			this.getUserInfo()
		},
		methods:{
			// 修改匹配
			setMate(e) {
				this.$api.sendRequest({
					url:'/api/User/mate',
					data:{
						is_mate:this.supeiValue?1:0
					}
				})
			},
			// 修改隐身
			setStealth() {
				this.$api.sendRequest({
					url:'/api/User/stealth',
					data:{
						is_stealth:this.switchValue?0:1		
					}
				})
			},
			// 获取用户信息
			getUserInfo() {
				this.$api.sendRequest({
					url: '/api/user/userInfo',
					success: res => {
						this.userInfo = res.data
						if(res.data.is_mate==1) {
							this.supeiValue=true
						}else {
							this.supeiValue=false
						}
						
						if(res.data.is_stealth==1) {	
							this.switchValue=false
						}else {
							this.switchValue=true
						}
					}
				})
			},
		}
	}
</script>

<style lang="scss">

</style>
